{include file="public/layout" /}


<link rel="stylesheet" href="__SKIN__/pictureViewer/css/pictureViewer.css?v={$version}">
<script src="__SKIN__/pictureViewer/js/pictureViewer.js?v={$version}"></script>
<script src="__SKIN__/pictureViewer/js/jquery.mousewheel.min.js?v={$version}"></script>
<script src="__SKIN__/pictureViewer/js/pictureViewer.js?v={$version}"></script>


<link type="text/css" rel="stylesheet" href="__PUBLIC__/plugins/imgfd/css/lrtk.css" />

<script type="text/javascript" src="__PUBLIC__/plugins/imgfd/js/jquery.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/plugins/imgfd/js/jquery.imgbox.pack.js"></script>

<script type="text/javascript">
    $(document).ready(function() {
        $(".bigPicture").imgbox();
    });
</script>

<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; overflow-y: scroll;">
<style type="text/css">
  .tb_child {
    background:#FFFFDF;
  }
  .jz{
      margin: 0 auto;
  }
</style>

<div class="page" style="box-shadow:none;">

	<div class="fbutton" style="float: none;width: 80px;">
			<a href="{:url('Workorder/add')}">
					<div class="add">
							<span><i class="fa fa-plus"></i>添加数据</span>
					</div>
			</a>
	</div>

  <form method="post">
    <div class="flexigrid">
      <div class="mDiv">
        <div class="ftitle">
          <h3>工单管理</h3>
          <h5>(共{$pager->totalRows}条数据)</h5>
        </div>
        <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>


        <form class="navbar-form form-inline" action="{:url('Workorder/index')}" method="get" onsubmit="layer_loading('正在处理');">

                {$searchform.hidden|default=''}

                <div class="sDiv">

                    <!--<div class="sDiv2">-->

                    <!--    <input type="text" size="30" name="keywords" value="{$Request.param.keywords}" class="qsbox" placeholder="名称搜索...">-->

                    <!--    <input type="submit" class="btn" value="搜索">-->

                    <!--</div>-->

                    <!-- <div class="sDiv2">

                        <input type="button" class="btn" value="重置" onClick="window.location.href='{:url('AdPosition/index')}';">

                    </div> -->

                </div>

            </form>


        <!--<div class="fbutton" style="float: none;">-->

        <!--        <a href="javascript:;" id="exportData">-->

        <!--            <div class="add">-->

        <!--                <span><i class="fa fa-plus"></i>导出数据</span>-->

        <!--            </div>-->

        <!--        </a>-->

        <!--    </div>-->

        <!--    <div class="fbutton" style="float: none;">-->
        <!--        <form id="img_form" method="post" action="{:url('Workorder/import')}" enctype="multipart/form-data" style="width:100px">-->
                
        <!--            <a href="javascript:;" id="importData">-->
        <!--                <div class="add">-->
        <!--                    <span><i class="fa fa-plus"></i>导入数据</span>-->
        <!--                </div>-->
        <!--            </a>     -->
        <!--            <input type="file" name="importFile" id="importFile" style="opacity: 0;display: none" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">-->
        <!--        </form>-->
        <!--    </div>-->


     <!--<form class="navbar-form form-inline" action="{:url('admin/fixedassets/index')}" method="get" onsubmit="layer_loading('正在处理');" >-->
     <!--       {$searchform.hidden|default=''}-->
     <!--       <div class="sDiv"  style="margin-right:1080px;margin-top:2px;color:red">-->
     <!--           <label for="start">选择月份</label>-->
     <!--           <div  class="sDiv2">-->
     <!--               <input type="date" name="keywords" value="{$Request.param.keywords}" class="qsbox" >-->
     <!--               <input type="submit" class="btn" value="查询">-->
     <!--           </div>-->
     <!--       </div>-->
     <!--   </form>-->
        
        <form class="navbar-form form-inline"  action="{:url('admin/arctype/index1')}" method="get" onsubmit="layer_loading('正在处理');"  >
            {$searchform.hidden|default=''}
            <div class="s" >
                <div class="ss" style="float: none;margin-left:800px"   <?php $admin_info = session('admin_info');  if($admin_info['role_id']!=-1){  echo 'style="display: none;"';  }?>>
                    <input type="text" size="30"  name="keywords1" value="{$Request.param.keywords1}" class="qsbox" placeholder="型号搜索...">
                    <input type="submit"  style="color:red" class="btn" value="搜索">
                </div>
            </div>
        </form>


      </div>

      <div class="hDiv">
        <div class="hDivBox">
          <table cellpadding="0" cellspacing="0" style="width: 100%">
            <thead>
              <tr>
                <th axis="col3" class="w60 tc">
                  <div class="sundefined tc">序号</div>
                </th>

                <th axis="col3" class="w100 tc">
                  <div class="tc" >提交人</div>
                </th>

                <th axis="col3" class="w100 tc">
                  <div class="tc" >型号</div>
                </th>

                <th axis="col3" class="w100 tc">
                  <div class="tc" >类别</div>
                </th>

                <th axis="col3" class="w150 tc">
                  <div class="tc" >视频</div>
                </th>
                
                <th axis="col3" class="w100 tc">
                  <div class="tc" >图片</div>
                </th>
                
                <th axis="col3" class="w130 tc" >
                  <div class="tc" >提交时间</div>
                </th>

                <th axis="col1" class="w300  tc">
                    <div class="tl" style="text-align:center">操作</div>
                </th>
              </tr>
            </thead>
          </table>
        </div>
      </div>

      <div id="flexigrid" class="bDiv" style="height: auto;">

        {empty name="list"}
        <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
            <table>
                <tbody>
                    <tr>
                        <td class="no-data" align="center" axis="col0" colspan="50">
                            <i class="fa fa-exclamation-circle"></i>没有符合条件的记录
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="iDiv" style="display: none;"></div>
        {else /}

        <table class="flex-table autoht" cellpadding="0" cellspacing="0" border="0" id="arctype_table" style="width: 100%">
           <tbody id="treet1" style="width: 100%">



           {foreach name="list" item="vo" key="k" }

            <tr nctype="0"  data-id="{$vo['id']}">
                <td class="name">
                    <div class="w60 tc jz">{$k+1}</div>
                </td>

                <td class="name">
                    <div class="w100 tc jz" >{$vo.submitter}</div>
                </td>

                

                <td class="name">
                    <div class="w100 tc jz" >{$vo.model}</div>
                </td>

                <td class="name">
                    <div class="w100 tc jz" >{$vo.category}</div>
                </td>

                <td class="name" >
                    <!--循环页面显示视频-->
                      <div class="w155 tc jz" >
                        <?php $video=empty($vo['video'])?array():explode(",",$vo['video']); ?>
                        {foreach name="video" item="v" }
                            <a class="bigPicture" title="" href="{$v}"><video src="{$v}" style="width:150px;float: none;" controls="controls" /><a>
                        <?php break; ?>
                        {/foreach}
                    </div>
                </td>
          
                
                <td class="name">
                    <div class="w100 tc jz" >
                        <?php $img=empty($vo['img'])?array():explode(",",$vo['img']); ?>
                        {foreach name="img" item="v" }
                            <a class="bigPicture" title="" href="{$v}"><img src="{$v}" style="width:100px;float: none;" /><a>
                        <?php break; ?>
                        {/foreach}
                    </div>
                </td>
                <td class="name">
                    <div class="w121 tc jz" >{$vo.month}</div>
                </td>

         
                <td class="name" >
                    <div class="w300 tc jz">

                    <!--<a href="{:url('Workorder/see',array('id'=>$vo['id']))}" class="btn blue">-->
                    <!--<i class="fa fa-pencil-square-o"></i>详情</a>-->

                    <!--<a href="{:url('Workorder/edit',array('id'=>$vo['id']))}" class="btn blue">-->
                    <!--<i class="fa fa-pencil-square-o"></i>编辑</a>-->

                    <a class="btn red"  href="javascript:void(0);" data-url="{:url('Workorder/del')}" data-id="{$vo.id}" onClick="delfun(this);">
                    <i class="fa fa-trash-o"></i>删除</a>
                    
                    </div>

                </td>

            </tr>

            {/foreach}                



          </tbody>



        </table>



        {/empty}



      </div> 



    </div>



  </form>
</div>


<script>

    $(document).ready(function(){

        $('.imageList').click(function (){

            var this_ = $(this);

            var images = this_.find('.imageList').find('.cover');

            var imagesArr = new Array();

            var host = 'http://'+location.host;

            $.each(images, function (i, image) {

                var url = $(image).children('img').attr('src');

                imagesArr.push(host+url);

            });

            

            $.pictureViewer({

                images: imagesArr, //需要查看的图片，数据类型为数组

                initImageIndex: 1, //初始查看第几张图片，默认1

                scrollSwitch: true //是否使用鼠标滚轮切换图片，默认false

            });

        });



        // 表格行点击选中切换

        $('#flexigrid > table>tbody >tr').click(function(){

            $(this).toggleClass('trSelected');

        });



        // 点击刷新数据

        $('.fa-refresh').click(function(){

            location.href = location.href;

        });

        $("#importData").click(function(){
            $("#importFile").trigger("click");
        })

        $("#importFile").change(function(){
            $("#img_form").submit();
        })

        $('#img_form').submit(function (e) {
            e.preventDefault();
            var uploadFile = document.querySelector("#importFile").files[0];
            var formData = new FormData();
            formData.append("importFile", uploadFile);

            $.ajax({
                 url:"{:url('Workorder/import')}",
                 data:formData,
                 type:"post",
                 dataType:"json",
                 cache:false,
                 contentType:false,
                 processData:false,
                 success:function(res){
                    if(res.status == 200){
                        location.reload();
                    }else{
                        alert(res.message);
                    }
                 },
                 error: function (e) {
                     console.log(e);
                 }
             });
         });

    });



    $('#exportData').click(function (){

        var keywords = $('input[name="keywords"]').val();

        var url = "{:url('Workorder/export')}";

        if (keywords == ''){

            window.open(url);

        }else {

            window.open(url+"&keywords="+keywords);

        }

    });



    /**

     * 代码调用js

     * @param id  id

     * @param limit 条数

     */

    function copyToClipBoard(id, limit) {

      var advstr = "{eyou:adv pid='" + id + "'}\r\n   <img src='{$"+"field.litpic}' alt='{$"+"field.title}' />\r\n{/eyou:adv";

      var contentdiv = '<div class="dialog_content" style="margin: 0px; padding: 0px;"><dl style="padding:10px 30px;line-height:30px"><dd>标签 adv 调用：</dd>'

      contentdiv += '<textarea rows="4" cols="60" style="width:400px;height:60px;">' + advstr + '}</textarea>'

      contentdiv += '<dd>JavaScript：</dd>'

      contentdiv += '<dd><input type="text" style=" width:400px;" value="<script type=&quot;text/javascript&quot; src=&quot;http://' + '{$Think.server.http_host}' + '/index.php?m=api&amp;c=Other&amp;a=other_show&amp;pid=' + id + '&amp;row='+limit+'&quot;><\/script>"></dd>'

      contentdiv += '<dd style="border-top: dotted 1px #E7E7E7; color: #F60;">请将标签adv或JavaScript代码复制并粘贴到对应模板文件中！</dd></dl></div>'

      layer.open({

        title: '代码调用',

        type: 1,

        skin: 'layui-layer-demo',

        area: ['480px', '280px'], //宽高

        content: contentdiv

      });

    }



</script>

{include file="public/footer" /}